package com.csdj.questions.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.csdj.questions.entity.TTopic;
import com.csdj.questions.mapper.TTopicMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 话题表 服务实现类
 * </p>
 *
 * @author 郭成星
 * @since 2022-03-06
 */
@Service
public class TTopicService extends ServiceImpl<TTopicMapper, TTopic> implements ITTopicService {

    @Autowired
    private TTopicMapper tTopicMapper;

    /**
     * 模糊查询话题
     *
     * @param topicText
     * @return
     */
    public List<TTopic> topicList(String topicText) {
        LambdaQueryWrapper<TTopic> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.select(TTopic::getTopicName, TTopic::getTopicId);
        queryWrapper.like(TTopic::getTopicName, topicText);

        return tTopicMapper.selectList(queryWrapper);

    }

}
